<?php
@include('include/common.inc.php');	
if($_POST['add']==1)
{
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
	if($_POST[agree]!=1)
	{
		MyNotice("先同意群格租屋會員規章才能注冊", 1, "news.php");
	}
	$user_id = work_str($_POST["user_id"], 1);			//中文标题  
	$name = work_str($_POST["name"], 1);		
	$pass1 =md5(work_str($_POST["pass1"], 1));			
	$sex = work_str($_POST["sex"], 1);			
	$mobile = work_str($_POST["mobile"], 1);		
	$birthyear = work_str($_POST["birthyear"], 1);		
	$birthmonth = work_str($_POST["birthmonth"], 1);		
	$birthday = work_str($_POST["birthday"], 1);		
	$birth =$birthyear.'-'.$birthmonth.'-'.$birthday;	
	$job = work_str($_POST["job"], 1);
	$email = work_str($_POST["email"], 1);
	$time =date('Y-m-d H:i:s');
	
	$sel = "select * from $TBL_MEM where user_id='$user_id' or mobile='$mobile' or email ='$email'";	
	$result = mysql_query($sel);
	if(mysql_fetch_array($result))
	{
		 MyNotice("該賬戶，郵箱，身份證，手機已經被注冊", 1, "news.php");
	}else{
		$insert = "insert into $TBL_MEM (id,user_id,name,password,sex,birth,profession,mobile,email,reg_time,type)
		values (null,'$user_id','$name','$pass1','$sex','$birth','$job','$mobile','$email','$time',1)";
		if(mysql_query($insert))
		{
			MyNotice("房客會員注冊成功，請登錄", 2, "login.php");
		}else{
			MyNotice("信息有誤,注冊失敗", 1, "login.php");
		}
	}
	
}

$selzc = "select * from $TBL_SET where id =1";
$reszc = mysql_query($selzc);
$rowzc = mysql_fetch_array($reszc);
$rule = $rowzc[rule];

$selxx1 = "select * from $TBL_OPTION where type=10 order by ord asc";
$resxx1 = mysql_query($selxx1);	
while($rowxx1 = mysql_fetch_array($resxx1))
{
   $jobb = $jobb ."<OPTION value=$rowxx1[title]>".$rowxx1[title]."</OPTION>";
}	
$smarty->assign("rule",$rule);
$smarty->assign("jobb",$jobb);
@include('number.php');//验证码
$smarty->display('tenant.html');

?>